package com.aspose.cells.a.d.a;

import com.aspose.cells.a.d.a.a.zcx;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.Image;
import java.awt.Paint;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.Toolkit;
import java.awt.RenderingHints.Key;
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
import java.awt.font.LineMetrics;
import java.awt.font.TextAttribute;
import java.awt.geom.AffineTransform;
import java.awt.geom.Area;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.awt.geom.Line2D.Double;
import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;
import java.awt.image.CropImageFilter;
import java.awt.image.FilteredImageSource;
import java.awt.image.ImageObserver;
import java.awt.image.RenderedImage;
import java.awt.image.renderable.RenderContext;
import java.awt.image.renderable.RenderableImage;
import java.text.AttributedCharacterIterator;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.Properties;

public class zc extends Graphics2D {
   private zj k;
   private Rectangle l;
   private Dimension m;
   private Color n;
   private Paint o;
   private Stroke p;
   private Color q;
   private Color r;
   private Color s;
   private Color t;
   private Font u;
   private Map v;
   private Map w;
   private zm x;
   private static final zm y = new zm();
   private static final String z = zc.class.getName();
   public static final String a;
   public static final String b;
   public static final String c;
   public static final String d;
   public static final String e;
   public static final String f;
   public static final String g;
   private RenderingHints A;
   protected Rectangle h;
   protected Area i;
   protected AffineTransform j;
   private static final Rectangle B;
   private boolean C;
   private int D;
   private int E;
   private int F;
   private int G;
   private int H;

   public zc(zj var1, Rectangle var2) {
      this(var1, var2, Color.BLACK);
   }

   public zc(zj var1, Rectangle var2, Color var3) {
      this.k = null;
      this.p = null;
      this.D = 0;
      this.E = 0;
      this.F = 0;
      this.G = 3;
      this.H = 0;
      this.k = var1;
      this.l = var2;
      this.a((Properties)y);
      this.v = new HashMap();
      this.w = new HashMap();
      this.m = new Dimension(var2.width, var2.height);
      this.h = this.m != null ? new Rectangle(0, 0, this.m.width, this.m.height) : null;
      this.i = null;
      this.j = new AffineTransform();
      this.setColor(var3);
      this.setFont(new Font("Dialog", 0, 12));
      this.C = false;
      this.A = new RenderingHints((Map)null);
      this.p = new BasicStroke(1.0F, 2, 0, 10.0F, (float[])null, 0.0F);
      this.setFont(new Font("Dialog", 0, 12));
      this.a();
      this.b();
   }

   public zc(zc var1, boolean var2) {
      this.k = null;
      this.p = null;
      this.D = 0;
      this.E = 0;
      this.F = 0;
      this.G = 3;
      this.H = 0;
      this.k = var1.k;
      this.l = var1.l;
      this.m = var1.m;
      this.n = com.aspose.cells.a.d.b.za.a(var1.n);
      this.o = com.aspose.cells.a.d.b.za.a(var1.o);
      this.p = com.aspose.cells.a.d.b.za.a(var1.p);
      this.q = com.aspose.cells.a.d.b.za.a(var1.q);
      this.r = com.aspose.cells.a.d.b.za.a(var1.r);
      this.s = com.aspose.cells.a.d.b.za.a(var1.s);
      this.t = com.aspose.cells.a.d.b.za.a(var1.t);
      this.u = com.aspose.cells.a.d.b.za.a(var1.u);
      this.x = var1.x;
      this.v = var1.v;
      this.w = var1.w;
      this.h = new Rectangle(var1.h);
      this.i = var1.i != null ? new Area(var1.i) : null;
      this.j = new AffineTransform(var1.j);
      this.A = var1.A;
      this.C = var2;
   }

   public Graphics create() {
      this.d();
      return new zc(this, true);
   }

   public void dispose() {
      if (this.C) {
         this.e();
         this.C = false;
      }

   }

   public void draw(Shape shape) {
      if (this.getStroke() instanceof BasicStroke) {
         Color var2 = this.getColor();
         if (var2.getAlpha() == 0) {
            return;
         }

         this.a((BasicStroke)this.getStroke(), this.getColor());
         if (this.F != 0) {
            this.k.h(this.F);
         }

         this.F = this.k.a(shape);
         this.k.a(this.l, this.D - 1, this.F - 1);
      } else {
         this.c();
         if (this.F != 0) {
            this.k.h(this.F);
         }

         this.F = this.k.a(this.getStroke().createStrokedShape(shape));
         this.k.b(this.l, this.E - 1, this.F - 1);
      }

   }

   public void clip(Shape shape) {
      Area var2 = new Area(shape);
      if (this.i != null) {
         this.i = new Area(this.b((Shape)this.i));
         this.i.intersect(var2);
      } else {
         this.i = var2;
      }

      this.setClip(this.i);
   }

   public void drawGlyphVector(GlyphVector glyphvector, float x, float y) {
      this.fill(glyphvector.getOutline(x, y));
   }

   public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) {
      this.drawImage(op.filter(img, (BufferedImage)null), x, y, (ImageObserver)null);
   }

   public boolean drawImage(Image image, AffineTransform xform, ImageObserver observer) {
      this.drawRenderedImage(com.aspose.cells.a.d.b.zb.a(image, observer, (Color)null), xform);
      return true;
   }

   public void drawRenderedImage(RenderedImage img, AffineTransform xform) {
      this.a(img, xform, (Color)null);
   }

   private void a(RenderedImage var1, AffineTransform var2, Color var3) {
      this.d();
      this.a(var2);
      this.k.a(var1, var3);
      this.e();
   }

   public void drawRenderableImage(RenderableImage image, AffineTransform xform) {
      this.drawRenderedImage(image.createRendering(new RenderContext(new AffineTransform(), this.getRenderingHints())), xform);
   }

   public void drawString(AttributedCharacterIterator iterator, float x, float y) {
      Font var4 = this.getFont();
      Color var5 = this.getColor();
      StringBuffer var6 = new StringBuffer();
      Font var7 = this.getFont();
      Color var8 = this.getColor();
      Hashtable var9 = new Hashtable();
      Object var10 = null;

      for(char var11 = iterator.first(); var11 != '\uffff'; var11 = iterator.next()) {
         var9.clear();
         var10 = iterator.getAttribute(TextAttribute.UNDERLINE);
         Font var12 = (Font)iterator.getAttribute(TextAttribute.FONT);
         Color var13 = (Color)iterator.getAttribute(TextAttribute.FOREGROUND);
         if (!var7.getAttributes().equals(var12.getAttributes()) || (var13 == null || var8 == null || !var8.equals(var13)) && (var13 != null || var8 != null)) {
            if (var6.length() > 0) {
               FontMetrics var14 = this.getFontMetrics(var7);
               var9.clear();
               if (var10 != null) {
                  var9.put(TextAttribute.UNDERLINE, var10);
               }

               this.a(var6.toString(), x, y, var9);

               for(int var15 = 0; var15 < var6.length(); ++var15) {
                  char var16 = var6.charAt(var15);
                  int var17 = var14.charWidth(var16);
                  x += (float)var17;
               }
            }

            var6 = new StringBuffer();
            var6.append(var11);
            this.setFont(var12);
            this.setColor(var13);
            var7 = var12;
            var8 = var13;
         } else {
            var6.append(var11);
         }
      }

      if (var6.length() > 0) {
         FontMetrics var18 = this.getFontMetrics(var7);
         var9.clear();
         if (var10 != null) {
            var9.put(TextAttribute.UNDERLINE, var10);
         }

         this.a(var6.toString(), x, y, var9);

         for(int var19 = 0; var19 < var6.length(); ++var19) {
            char var20 = var6.charAt(var19);
            int var21 = var18.charWidth(var20);
            x += (float)var21;
         }
      }

      this.setFont(var4);
      this.setColor(var5);
   }

   public void drawString(AttributedCharacterIterator iterator, int x, int y) {
      this.drawString(iterator, (float)x, (float)y);
   }

   public void drawString(String str, int x, int y) {
      this.drawString(str, (float)x, (float)y);
   }

   public void drawString(String str, float x, float y) {
      this.a(str, x, y, (Map)null);
   }

   private void a(String var1, float var2, float var3, Map<TextAttribute, ?> var4) {
      if (var1 != null && !var1.equals("")) {
         if (this.b(e)) {
            Font var5 = this.getFont();
            String var6 = var5.getName();
            if (var6.equals("Symbol") || var6.equals("ZapfDingbats")) {
               var5 = new Font("Serif", var5.getStyle(), var5.getSize());
            }

            GlyphVector var7 = var5.createGlyphVector(this.getFontRenderContext(), var1);
            this.drawGlyphVector(var7, var2, var3);
         } else {
            this.a(var1, (double)var2, (double)var3, var4);
         }

      }
   }

   public void fill(Shape shape) {
      if (this.getPaint() != null) {
         if (this.getPaint() instanceof GradientPaint) {
            Rectangle2D var2 = shape.getBounds2D();
            GradientPaint var3 = (GradientPaint)this.getPaint();
            Point2D var4 = var3.getPoint1();
            Point2D var5 = var3.getPoint2();
            Color var6 = var3.getColor1();
            Color var7 = var3.getColor2();
            double var8 = var2.getX();
            double var10 = var2.getY();
            double var12 = var2.getWidth();
            double var14 = var2.getHeight();
            zc var16 = null;
            zc var17 = null;

            try {
               var16 = (zc)this.create();
               var16.clip(shape);
               var17 = (zc)var16.create();
               com.aspose.cells.a.d.b.za.a(var17, var8, var10, var12, var14, var4, var5, var6, var7);
            } catch (Exception var22) {
               com.aspose.cells.a.c.zl.b(var22);
            } finally {
               if (var17 != null) {
                  var17.dispose();
               }

               if (var16 != null) {
                  var16.dispose();
               }

            }
         } else {
            this.c();
            if (this.F != 0) {
               this.k.h(this.F);
            }

            this.F = this.k.a(shape);
            this.k.b(this.l, this.E - 1, this.F - 1);
         }

      }
   }

   public Color getBackground() {
      return this.q;
   }

   public Composite getComposite() {
      throw new RuntimeException("The method is not supported");
   }

   public GraphicsConfiguration getDeviceConfiguration() {
      throw new RuntimeException("The method is not supported");
   }

   public FontRenderContext getFontRenderContext() {
      return new FontRenderContext(new AffineTransform(1.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F), true, true);
   }

   public Paint getPaint() {
      return this.o;
   }

   public Object getRenderingHint(Key hintKey) {
      return this.A.get(hintKey);
   }

   public RenderingHints getRenderingHints() {
      return (RenderingHints)this.A.clone();
   }

   public Stroke getStroke() {
      return this.p;
   }

   public AffineTransform getTransform() {
      return new AffineTransform(this.j);
   }

   public boolean hit(Rectangle rect, Shape s, boolean onStroke) {
      throw new RuntimeException("The method is not supported");
   }

   public void rotate(double theta) {
      this.j.rotate(theta);
      this.a(new AffineTransform(Math.cos(theta), Math.sin(theta), -Math.sin(theta), Math.cos(theta), 0.0D, 0.0D));
   }

   public void rotate(double theta, double x, double y) {
      this.j.rotate(theta, x, y);
      this.a(new AffineTransform(Math.cos(theta), Math.sin(theta), -Math.sin(theta), Math.cos(theta), x, y));
   }

   public void scale(double sx, double sy) {
      this.j.scale(sx, sy);
      this.a(new AffineTransform(sx, 0.0D, 0.0D, sy, 0.0D, 0.0D));
   }

   public void setBackground(Color color) {
      this.q = color;
   }

   public void setComposite(Composite comp) {
      throw new RuntimeException("The method is not supported");
   }

   public void setPaint(Paint paint) {
      if (paint == null) {
         this.o = null;
      } else {
         if (paint.equals(this.o)) {
            return;
         }

         if (paint instanceof Color) {
            this.setColor((Color)paint);
         }

         this.o = paint;
      }

   }

   public void setRenderingHint(Key hintKey, Object hintValue) {
      if (hintKey != null && hintValue != null) {
         this.A.put(hintKey, hintValue);
         if (hintKey == RenderingHints.KEY_ANTIALIASING) {
            if (hintValue == RenderingHints.VALUE_ANTIALIAS_OFF) {
               if (this.A.get(RenderingHints.KEY_RENDERING) == RenderingHints.VALUE_RENDER_SPEED) {
                  if (this.G != 1) {
                     this.G = 1;
                     this.k.i(this.G);
                  }
               } else if (this.G != 3) {
                  this.G = 3;
                  this.k.i(this.G);
               }
            } else if (hintValue == RenderingHints.VALUE_ANTIALIAS_ON) {
               if (this.A.get(RenderingHints.KEY_RENDERING) == RenderingHints.VALUE_RENDER_QUALITY) {
                  if (this.G != 2) {
                     this.G = 2;
                     this.k.i(this.G);
                  }
               } else if (this.G != 4) {
                  this.G = 4;
                  this.k.i(this.G);
               }
            } else {
               Object var3 = this.A.get(RenderingHints.KEY_RENDERING);
               if (var3 == RenderingHints.VALUE_RENDER_QUALITY) {
                  if (this.G != 2) {
                     this.G = 2;
                     this.k.i(this.G);
                  }
               } else if (var3 == RenderingHints.VALUE_RENDER_SPEED) {
                  if (this.G != 1) {
                     this.G = 1;
                     this.k.i(this.G);
                  }
               } else if (this.G != 0) {
                  this.G = 0;
                  this.k.i(this.G);
               }
            }
         } else if (hintKey == RenderingHints.KEY_RENDERING) {
            if (hintValue == RenderingHints.VALUE_RENDER_QUALITY) {
               if (this.G != 2) {
                  this.G = 2;
                  this.k.i(this.G);
               }
            } else if (hintValue == RenderingHints.VALUE_RENDER_SPEED) {
               if (this.G != 1) {
                  this.G = 1;
                  this.k.i(this.G);
               }
            } else {
               hintValue = this.A.get(RenderingHints.KEY_ANTIALIASING);
               if (hintValue == RenderingHints.VALUE_ANTIALIAS_ON) {
                  if (this.G != 4) {
                     this.G = 4;
                     this.k.i(this.G);
                  }
               } else if (hintValue == RenderingHints.VALUE_ANTIALIAS_OFF) {
                  if (this.G != 3) {
                     this.G = 3;
                     this.k.i(this.G);
                  }
               } else if (this.G != 0) {
                  this.G = 0;
                  this.k.i(this.G);
               }
            }
         } else if (hintKey == RenderingHints.KEY_TEXT_ANTIALIASING) {
            byte var4 = 0;
            if (hintValue == RenderingHints.VALUE_TEXT_ANTIALIAS_ON) {
               var4 = 4;
            } else if (hintValue == RenderingHints.VALUE_TEXT_ANTIALIAS_ON) {
               var4 = 2;
            }

            if (this.H != var4) {
               this.H = var4;
               this.k.j(var4);
            }
         }

      }
   }

   private void a(Map var1) {
      Object var2 = var1.get(RenderingHints.KEY_ANTIALIASING);
      if (var2 == RenderingHints.VALUE_ANTIALIAS_ON && this.G != 4) {
         this.G = 4;
         this.k.i(this.G);
      }

      var2 = var1.get(RenderingHints.KEY_RENDERING);
      if (var2 != null) {
         if (var2 == RenderingHints.VALUE_RENDER_QUALITY) {
            if (this.G != 2) {
               this.G = 2;
               this.k.i(this.G);
            }
         } else if (var2 == RenderingHints.VALUE_RENDER_SPEED) {
            var2 = var1.get(RenderingHints.KEY_ANTIALIASING);
            if (var2 == RenderingHints.VALUE_ANTIALIAS_ON) {
               if (this.G != 4) {
                  this.G = 4;
                  this.k.i(this.G);
               }
            } else if (this.G != 1) {
               this.G = 1;
               this.k.i(this.G);
            }
         } else {
            var2 = var1.get(RenderingHints.KEY_ANTIALIASING);
            if (var2 != null) {
               if (var2 == RenderingHints.VALUE_ANTIALIAS_ON) {
                  if (this.G != 4) {
                     this.G = 4;
                     this.k.i(this.G);
                  }
               } else if (this.G != 0) {
                  this.G = 0;
                  this.k.i(this.G);
               }
            }
         }
      }

      var2 = var1.get(RenderingHints.KEY_TEXT_ANTIALIASING);
      if (var2 != null) {
         byte var3 = 0;
         if (var2 == RenderingHints.VALUE_TEXT_ANTIALIAS_ON) {
            var3 = 4;
         } else if (var2 == RenderingHints.VALUE_TEXT_ANTIALIAS_ON) {
            var3 = 2;
         }

         if (this.H != var3) {
            this.H = var3;
            this.k.j(var3);
         }
      }

   }

   public void addRenderingHints(Map hintsNew) {
      this.A.putAll(hintsNew);
      this.a(hintsNew);
   }

   public void setRenderingHints(Map hintsNew) {
      this.A.clear();
      this.A.putAll(hintsNew);
      this.a(hintsNew);
   }

   public void setStroke(Stroke stroke) {
      if (stroke != null) {
         if (!stroke.equals(this.getStroke())) {
            if (stroke instanceof BasicStroke) {
               this.a((BasicStroke)stroke, this.getColor());
            }

            this.p = stroke;
         }
      }
   }

   public void setTransform(AffineTransform tx) {
      this.j.setTransform(tx);
      this.b(tx);
   }

   public void shear(double shx, double shy) {
      this.j.shear(shx, shy);
      this.a(new AffineTransform(1.0D, shy, shx, 1.0D, 0.0D, 0.0D));
   }

   public void transform(AffineTransform tx) {
      if (tx != null) {
         this.j.concatenate(tx);
         this.a(tx);
      }

   }

   public void translate(int x, int y) {
      this.j.translate((double)x, (double)y);
      this.a(new AffineTransform(1.0F, 0.0F, 0.0F, 1.0F, (float)x, (float)y));
   }

   public void translate(double tx, double ty) {
      this.j.translate(tx, ty);
      this.a(new AffineTransform(1.0D, 0.0D, 0.0D, 1.0D, tx, ty));
   }

   public void clearRect(int x, int y, int width, int height) {
      Paint var5 = this.getPaint();
      this.setPaint(this.getBackground());
      this.fillRect(x, y, width, height);
      this.setPaint(var5);
   }

   public void a(double var1, double var3, double var5, double var7) {
      this.clearRect((int)var1, (int)var3, (int)var5, (int)var7);
   }

   public void clipRect(int x, int y, int width, int height) {
      throw new RuntimeException("The method is not supported");
   }

   public void copyArea(int x, int y, int width, int height, int dx, int dy) {
      throw new RuntimeException("The method is not supported");
   }

   public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) {
      throw new RuntimeException("The method is not supported");
   }

   public boolean drawImage(Image image, int x, int y, ImageObserver observer) {
      int var5 = image.getWidth(observer);
      int var6 = image.getHeight(observer);
      return this.drawImage(image, x, y, x + var5, y + var6, 0, 0, var5, var6, (Color)null, observer);
   }

   public boolean drawImage(Image image, int x, int y, int width, int height, ImageObserver observer) {
      int var7 = image.getWidth(observer);
      int var8 = image.getHeight(observer);
      return this.drawImage(image, x, y, x + width, y + height, 0, 0, var7, var8, (Color)null, observer);
   }

   public boolean drawImage(Image image, int x, int y, Color bgColor, ImageObserver observer) {
      int var6 = image.getWidth(observer);
      int var7 = image.getHeight(observer);
      return this.drawImage(image, x, y, x + var6, y + var7, 0, 0, var6, var7, bgColor, observer);
   }

   public boolean drawImage(Image image, int x, int y, int width, int height, Color bgColor, ImageObserver observer) {
      int var8 = image.getWidth(observer);
      int var9 = image.getHeight(observer);
      return this.drawImage(image, x, y, x + width, y + height, 0, 0, var8, var9, bgColor, observer);
   }

   public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) {
      return this.drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, (Color)null, observer);
   }

   public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer) {
      int var12 = Math.min(sx1, sx2);
      int var13 = Math.min(sy1, sy2);
      int var14 = Math.abs(sx2 - sx1);
      int var15 = Math.abs(sy2 - sy1);
      int var16 = Math.abs(dx2 - dx1);
      int var17 = Math.abs(dy2 - dy1);
      if (var12 != 0 || var13 != 0 || var14 != image.getWidth(observer) || var15 != image.getHeight(observer)) {
         CropImageFilter var18 = new CropImageFilter(var12, var13, var14, var15);
         image = Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(image.getSource(), var18));
      }

      boolean var28 = dx2 < dx1 ^ sx2 < sx1;
      boolean var19 = dy2 < dy1 ^ sy2 < sy1;
      double var20 = var28 ? (double)dx2 : (double)dx1;
      double var22 = var19 ? (double)dy2 : (double)dy1;
      double var24 = (double)var16 / (double)var14;
      var24 = var28 ? -1.0D * var24 : var24;
      double var26 = (double)var17 / (double)var15;
      var26 = var19 ? -1.0D * var26 : var26;
      this.a(com.aspose.cells.a.d.b.zb.a(image, observer, bgcolor), new AffineTransform(var24, 0.0D, 0.0D, var26, var20, var22), bgcolor);
      return true;
   }

   public void drawLine(int x1, int y1, int x2, int y2) {
      Double var5 = new Double((double)x1, (double)y1, (double)x2, (double)y2);
      this.draw(var5);
   }

   public void b(double var1, double var3, double var5, double var7) {
      Double var9 = new Double(var1, var3, var5, var7);
      this.draw(var9);
   }

   public void drawOval(int x, int y, int width, int height) {
      throw new RuntimeException("The method is not supported");
   }

   public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) {
      throw new RuntimeException("The method is not supported");
   }

   public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) {
      throw new RuntimeException("The method is not supported");
   }

   public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) {
      throw new RuntimeException("The method is not supported");
   }

   public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) {
      this.fill(new java.awt.geom.Arc2D.Double((double)x, (double)y, (double)width, (double)height, (double)startAngle, (double)arcAngle, 2));
   }

   public void fillOval(int x, int y, int width, int height) {
      this.fill(new java.awt.geom.Ellipse2D.Double((double)x, (double)y, (double)width, (double)height));
   }

   public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) {
      throw new RuntimeException("The method is not supported");
   }

   public void fillRect(int x, int y, int width, int height) {
      this.fill(new java.awt.geom.Rectangle2D.Double((double)x, (double)y, (double)width, (double)height));
   }

   public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) {
      throw new RuntimeException("The method is not supported");
   }

   public Shape getClip() {
      return this.i != null ? new Area(this.b((Shape)this.i)) : null;
   }

   public Rectangle getClipBounds() {
      throw new RuntimeException("The method is not supported");
   }

   public Color getColor() {
      return this.n;
   }

   public Font getFont() {
      return this.u;
   }

   public FontMetrics getFontMetrics(Font f) {
      return Toolkit.getDefaultToolkit().getFontMetrics(f);
   }

   public void setClip(int x, int y, int width, int height) {
      throw new RuntimeException("The method is not supported");
   }

   public void setClip(Shape clip) {
      Shape var2 = this.a(clip);
      this.i = var2 != null ? new Area(var2) : null;
      this.c(clip);
   }

   public void setColor(Color color) {
      if (color != null) {
         if (!color.equals(this.n)) {
            this.n = color;
            this.k.a(color);
         }
      }
   }

   public void setFont(Font font) {
      if (font != null) {
         this.u = font;
      }
   }

   public void setPaintMode() {
      throw new RuntimeException("The method is not supported");
   }

   public void setXORMode(Color c1) {
      throw new RuntimeException("The method is not supported");
   }

   private void a(BasicStroke var1, Color var2) {
      if (!var2.equals(this.r) || !var1.equals(this.getStroke())) {
         if (this.D != 0) {
            this.k.h(this.D);
         }

         this.D = this.k.a(var1, var2, this.getStroke(), this.j);
         this.r = var2;
      }
   }

   private void c() {
      Paint var1 = this.getPaint();
      if (var1 instanceof Color) {
         Color var2 = (Color)var1;
         if (var2.equals(this.s)) {
            return;
         }

         if (this.E != 0) {
            this.k.h(this.E);
         }

         this.E = this.k.a(var1);
         this.s = var2;
      } else {
         if (this.E != 0) {
            this.k.h(this.E);
         }

         this.E = this.k.a(var1);
      }

   }

   private void a(String var1, double var2, double var4, Map<TextAttribute, ?> var6) {
      Paint var8 = this.getPaint();
      Color var7;
      if (var8 instanceof Color) {
         var7 = (Color)var8;
      } else if (var8 instanceof GradientPaint) {
         GradientPaint var9 = (GradientPaint)var8;
         var7 = zl.a(var9.getColor1(), var9.getColor2());
      } else {
         Color var19 = this.getBackground();
         if (var19 == null) {
            var7 = Color.BLACK;
         } else {
            var7 = var19;
         }
      }

      if (!var7.equals(this.t)) {
         this.t = var7;
         this.k.a(this.t);
      }

      Hashtable var20 = zl.a(this.getFont());
      zl.a((Map)var20);
      Font var10 = new Font(var20);
      Font var11 = (Font)this.w.get(var10);
      Integer var12 = (Integer)this.v.get(var10);
      int var15;
      if (var12 == null) {
         String var13 = var10.getName();
         String var14 = zl.a(var13);
         var11 = (new Font(var14, var10.getStyle(), var10.getSize())).deriveFont(var20);
         var11 = var11.deriveFont(var10.getSize2D() * 1.0F * 20.0F);
         this.w.put(var10, var11);
         var15 = this.k.a(var11, var6);
         var12 = new Integer(var15);
         this.v.put(var10, var12);
      }

      this.k.g(var12);
      int[] var21 = new int[var1.length()];
      FontRenderContext var22 = new FontRenderContext(this.getTransform(), true, true);

      for(var15 = 0; var15 < var21.length; ++var15) {
         Rectangle2D var16 = var11.getStringBounds(var1, var15, var15 + 1, var22);
         double var17 = var16.getWidth();
         var21[var15] = (int)Math.round(var17);
      }

      this.translate(var2, var4);
      AffineTransform var23 = var10.getTransform();
      if (!var23.isIdentity()) {
         this.d();
         this.a(var23);
      }

      zcx var24 = new zcx(new Point(0, 0), var1, 0, B, var21);
      LineMetrics var25 = var11.getLineMetrics(var1, var22);
      this.k.a(new Rectangle(0, (int)(-var25.getAscent()), Integer.MAX_VALUE, Integer.MAX_VALUE), 2, 1.0F, 1.0F, var24, this.t, var12);
      if (!var23.isIdentity()) {
         this.e();
      }

      this.translate(-var2, -var4);
   }

   private void d() {
      this.k.b();
   }

   private void e() {
      if (this.D != 0) {
         this.k.h(this.D);
         this.D = 0;
      }

      if (this.E != 0) {
         this.k.h(this.E);
         this.E = 0;
      }

      if (this.F != 0) {
         this.k.h(this.F);
         this.F = 0;
      }

      this.k.c();
   }

   public void a(AffineTransform var1) {
      AffineTransform var2 = new AffineTransform(var1.getScaleX(), var1.getShearY(), var1.getShearX(), var1.getScaleY(), var1.getTranslateX() * 1.0D * 20.0D, var1.getTranslateY() * 1.0D * 20.0D);
      this.k.a(var2, 2);
   }

   public void b(AffineTransform var1) {
      AffineTransform var2 = AffineTransform.getScaleInstance(0.05D, 0.05D);
      this.k.a(var2);
      this.a(var1);
   }

   public void a() {
      AffineTransform var1 = AffineTransform.getScaleInstance(0.05D, 0.05D);
      this.k.a(var1);
      this.setClip(this.getClip());
   }

   public void b() {
      if (this.b(a)) {
         this.setBackground((Color)null);
         this.k.f(1);
      } else if (this.b(b)) {
         this.k.f(2);
         this.setBackground(this.a(c));
         this.a(0.0D, 0.0D, this.m.getWidth(), this.m.getHeight());
      } else {
         this.k.f(2);
         this.a(0.0D, 0.0D, this.m.getWidth(), this.m.getHeight());
      }

   }

   private Shape a(AffineTransform var1, Shape var2) {
      return var2 == null ? null : var1.createTransformedShape(var2);
   }

   private Shape a(Shape var1) {
      return this.a(this.getTransform(), var1);
   }

   private Shape b(Shape var1) {
      if (var1 == null) {
         return null;
      } else {
         try {
            return this.a(this.getTransform().createInverse(), var1);
         } catch (Exception var3) {
            return null;
         }
      }
   }

   private void c(Shape var1) {
      if (var1 == null && this.l != null) {
         var1 = new Rectangle(this.l);
         AffineTransform var2 = this.getTransform();
         if (var2 != null) {
            var1 = var2.createTransformedShape((Shape)var1);
         }
      }

      this.F = this.k.b((Shape)var1);
   }

   protected void a(Properties var1) {
      this.x = new zm();
      this.x.a(var1);
   }

   public Color a(String var1) {
      return this.x.a(var1);
   }

   public boolean b(String var1) {
      return this.x.b(var1);
   }

   static {
      a = z + "." + "Transparent";
      b = z + "." + "Background";
      c = z + "." + "BackgroundColor";
      d = z + ".EMIT_WARNINGS";
      e = z + "." + "TEXT_AS_SHAPES";
      f = z + ".EMIT_ERRORS";
      g = z + ".CLIP";
      B = new Rectangle(0, 0, -1, -1);
      y.a(a, true);
      y.a(b, false);
      y.a(c, Color.GRAY);
      y.a(g, true);
      y.a(e, false);
   }
}
